"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const format_1 = __importDefault(require("date-fns/format"));
class DefaultLoggerWriter {
    constructor(name, options = {}) {
        this.name = name;
        this.options = options;
        this.timeFormat = 'yyyy-MM-dd HH:mm:ss.SSS';
        this.updateOptions(options);
    }
    format(methodName, time) {
        return `${this.formatTime(new Date())} ${this.formatLevel(methodName)} ${this.formatName(this.name)}`;
    }
    write(methodName, time, ...msg) {
    }
    updateOptions(options) {
        if (typeof options.timeFormat === 'string') {
            this.timeFormat = options.timeFormat;
        }
        if (typeof options.traceFunction === 'function') {
            this.traceFunction = options.traceFunction;
        }
    }
    getTraceStack() {
        const stack = new Error('Trace');
        if (this.traceFunction) {
            Error.captureStackTrace(stack, this.traceFunction);
        }
        return stack.stack ? stack.stack.split('\n').slice(1).join('\n') : '';
    }
    formatTime(time) {
        return format_1.default(time, this.timeFormat);
    }
    formatLevel(methodName) {
        return methodName.toUpperCase();
    }
    formatName(loggerName) {
        return `(${loggerName})`;
    }
}
exports.DefaultLoggerWriter = DefaultLoggerWriter;
